package temp.lho.lws.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.Mapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import temp.lho.lws.pojo.SysUserInfo;
import temp.lho.lws.result.ResultBody;
import temp.lho.lws.service.IAccidentService;
import temp.lho.lws.service.impl.SysUserInfo1ServiceImpl;
import temp.lho.lws.vo.Accident;
import temp.lho.lws.vo.LayuiResult;

import java.util.List;

@RestController
@RequestMapping("/accident")
public class AccidentContrller {
    @Autowired
    private IAccidentService accidentService;

    @Autowired
    private SysUserInfo1ServiceImpl sysUserInfo1Service;

    @RequestMapping("/selectAll")
    public LayuiResult selectAll(){
        List<Accident> accidents =accidentService.selectAll();
        LayuiResult layuiResult = new LayuiResult(0, "", accidents.size(), accidents);
        return layuiResult;
    }

    @RequestMapping("/select")
    public LayuiResult select(){
        List<Accident> accidents =accidentService.select();
        LayuiResult layuiResult = new LayuiResult(0, "", accidents.size(), accidents);
        return layuiResult;
    }

    @RequestMapping("/selectName")
    public LayuiResult selectName(){
        List<SysUserInfo> sysUserInfos =sysUserInfo1Service.selectName();
        LayuiResult layuiResult = new LayuiResult(0, "", sysUserInfos.size(), sysUserInfos);
        return layuiResult;
    }
}
